<template>
  <el-dialog
    title="原始货主"
    :visible.sync="dialogTableVisible"
    :before-close="cancelDialog"
  >
    <el-table :data="gridData" @row-click="handle">
      <el-table-column
        property="date"
        label="日期"
        width="150"
      ></el-table-column>
      <el-table-column
        property="name"
        label="姓名"
        width="200"
      ></el-table-column>
      <el-table-column property="address" label="地址"></el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancelDialog">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    dialogTableVisible: {
      type: Boolean,
      default: false,
    },
    // flag:{
    //     type:Number,
    //     default:1
    // }
  },
  data() {
    return {
      nameData: null,
      gridData: [
        {
          id: 1,
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: 2,
          date: "2016-05-04",
          name: "王小虎1",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: 3,
          date: "2016-05-01",
          name: "王小虎2",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: 4,
          date: "2016-05-03",
          name: "王小虎3",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
    };
  },
  //   watch: {
  //     dialogTableVisible(newValue) {
  //       this.localDialogTableVisible = newValue;
  //     },
  //   },
  methods: {
    cancelDialog() {
      this.$emit("closeDialog", false);
    },
    handle(row) {
      console.log(111, row);
      this.nameData = row;
    },
    submit() {
       this.$emit("submitValue",this.nameData);
       this.$emit("closeDialog", false);
    },
  },
};
</script>

<style>
</style>